﻿namespace Sidvall.FileSystemManager.Net.Services.V1
{
	public sealed partial class SearchConfig
	{
		#region Deserialize

		public static SearchConfig Deserialize(string value)
		{
			Sidvall.FileSystemManager.Net.Services.V1.SearchConfig dataItem;

			try
			{
				if (!string.IsNullOrWhiteSpace(value))
					dataItem = Sidvall.Serialization.SerializerManager.Current.Deserialize<Sidvall.FileSystemManager.Net.Services.V1.SearchConfig>(value);
				else
					dataItem = null;
			}
			catch
			{
				dataItem = null;
			}
			if (dataItem == null)
			{
				dataItem = new Sidvall.FileSystemManager.Net.Services.V1.SearchConfig()
				{
					SearchConfigId = 1,
					FolderPath = "** PATH TO ROOT FOLDER **",
					FileSearchPatterns = CodeManager.SearchPatterns,
					SearchPatterns = "",
					CaseSensitive = true,
					SearchFolderName = false,
					SearchFileContent = true,
					SearchFileName = true,
				};
			}
			return dataItem;
		}

		#endregion
	}
}